package com.lightkits.wms.domain.mainpage;

import com.lightkits.framework.soa.hzero.executor.ServiceExecutor;
import com.lightkits.wms.dto.mainpage.QueryItemByMoNumRequestType;
import com.lightkits.wms.dto.mainpage.QueryItemByMoNumResponseType;
import com.lightkits.wms.domain.mainpage.service.ItemInfoByMoDomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * QueryItemByMoNumExecutor
 *
 * @author menxiao.wu@hand-china.com
 * Created on 2019-02-21 12:29
 */
@Component
public class QueryItemByMoNumExecutor implements ServiceExecutor<QueryItemByMoNumRequestType, QueryItemByMoNumResponseType> {

    private final ItemInfoByMoDomainService service;

    @Autowired
    public QueryItemByMoNumExecutor(ItemInfoByMoDomainService service){
        this.service = service;
    }

    @Override
    public QueryItemByMoNumResponseType service(QueryItemByMoNumRequestType request) {
        QueryItemByMoNumResponseType response = new QueryItemByMoNumResponseType();
        response.setSuccessful(true);

        String moNum = request.getMoNum();
//        if (!ObjectUtil.isNullOrEmpty(moNum)){
//            BdMoBase moBase=new BdMoBase().se(new EntityWrapper().eq(BdMoBase.MO_NUM,moNum));
//        }

        response.setMoItemInfoDTO(service.getItemInfoByMoNum(moNum));

        return response;
    }
}
